package com.itheima_3;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

/*
* 测试类
* */
public class CollectionDemo {
    public static void main(String[] args) {

        Collection<Student> c = new ArrayList<Student>();

        Student s = new Student();
        s.setName("张三");
        s.setAge("18");
        Student s1 = new Student("李四","22");
        Student s2 = new Student("六五","39");

        c.add(s);
        c.add(s1);
        c.add(s2);

        Iterator<Student> it = c.iterator();
        while (it.hasNext()) {
            Student ss = it.next();
            System.out.println("名字："+ss.getName()+","+"年龄："+ss.getAge());
        }

    }
}
